<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../base.jsp"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<link href="../css/main.css" rel="stylesheet" type="text/css" >
<link href="../css/table.css" rel="stylesheet" type="text/css" >
<link rel="stylesheet" type="text/css" href="${path}/js/jquery/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${path}/js/jquery/easyui/themes/icon.css">
<script src="${path}/js/jquery/easyui/jquery-1.8.0.min.js"></script>
<script src="${path}/js/jquery/easyui/jquery.easyui.min.js"></script>
<!-- rsa -->
<script type="text/javascript" src="${path}/js/rsa_js/RSA.js"></script>
<script type="text/javascript" src="${path}/js/rsa_js/BigInt.js"></script>
<script type="text/javascript" src="${path}/js/rsa_js/Barrett.js"></script>
<script type="text/javascript" src="${path}/js/rsa_js/myrsa.js"></script>
<script type="text/javascript">
$(function(){
	$('#win').window('open');
})
function submit1(){
      if(!$('#form1').form('validate')){
		alert('数据填写不完整');
		return;
	  }
	  if($('#oldPasswordId').val()==$('#rsaPasswordId').val()){
	  	alert('新密码和旧密码不能相同'); 
        return;
	  }
      if($('#passwordR').val()!=$('#rsaPasswordId').val()){
          alert('两次输入密码不相同'); 
          return;
	  }
	  if(validate_password($('#passwordR').val())){
		  $('#passwordR').val('');
	    
		  rsaPwd('rsaPasswordId');
		  document.form1.submit();
	  }
	  
}
function validate_password(password){
	if(password==''){
		alert('密码不能为空');
		return false;
	}
	if(password.length < 6 ||password.length > 40 ){
		alert('密码必须由6-40个字符组成');
		return false;
	}
	if(!/^([0-9a-zA-Z\_`!~@#$%^*+=,.?;'":)(}{/\\\|<>&\[\-]|\])+$/.test(password)){
		alert('密码仅支持数字，字母和符号，且密码中不能含有空格');
		return false;
	}
	return true;
}


</script>
</head>
<body class="font14">
  <div style="text-align: center; color: red;">
  	<s:property value="#attr.result"/>
  </div>
  <div id="win" class="easyui-window" title="密码修改" style="width:520px; height: 350px;"> 
	<s:form name = "form1" id = "form1" action="emp_changePwd.action" namespace="/admin123/user"  cssStyle="padding:10px 20px 10px 40px;" theme="simple">
	      <table style="line-height: 35px;" align="center">
	      	<tr>
	      		<td>原密码：</td>
	      		<td>
	      			<input type="password" name="oldPassword" id="oldPasswordId" class="easyui-validatebox" data-options="required:true" maxlength="40">
	      			<input type="button" value="密码安全控件" onclick="showkeyboard('form1.oldPassword')">
	      		</td>
	      	</tr>
	      	<tr>
	      		<td>新密码：</td>
	      		<td>
	      			<input type="password" name="password" id="rsaPasswordId" class="easyui-validatebox"  data-options="required:true,missingMessage:'注:密码长度范围为6-40位字符,且不能为纯数字或纯字母'" maxlength="40">
	      			<input type="button" value="密码安全控件" onclick="showkeyboard('form1.password')">
	      		</td>
	      	</tr>
			<tr>	
				<td>确认密码:</td>
				<td>
					<input type="password" name="passwordR" id="passwordR" class="easyui-validatebox" data-options="required:true" maxlength="40">
					<input type="button" value="密码安全控件" onclick="showkeyboard('form1.passwordR')">
				</td>
			</tr>
	      	<tr>
	      		<td colspan="2">
	      			<div id="keyboardContainer" style="position: absolute;left: 2px;z-index:18000;"/>
	      		</td>
	      	</tr>
	      	<tr>
	      		<td colspan="2" style="text-align: left;">
	      			<font color="red"> 注：密码长度范围为6-40位字符,且不能为纯数字或纯字母</font>
	      		</td>
	      	</tr>
	      	<tr>
	      		<td colspan="2" align="center">
			      <a href="#" class="easyui-linkbutton" icon="icon-add" onclick="submit1();">
			      	提交
			      </a> 
	      		</td>
	      	</tr>
	      </table>
	   </s:form>
   </div>
  
</form>
</body>
<script type="text/javascript" src="${path}/js/keyboard.js"></script>
</html>